import {
  AppOutline,
  MessageOutline,
  MessageFill,
  UserOutline,
} from 'antd-mobile-icons'

import { lazy } from 'react'
import { createBrowserRouter } from 'react-router-dom'
import MainLayout from '../pages/mainLayout/MainLayout'
import Login from '../pages/login/Login'
import Regaiter from '../pages/register/Register'
import Error from '../pages/error/Error'
import Detail from '../pages/detail/Detail'
import City from '../pages/city/City'
import Xuan from '../pages/xuan/Xuan'
import Order from '../pages/order/Order'

let Message = lazy(()=>import('../pages/message/Message'))
let Props = lazy(()=>import('../pages/props/Props'))
let Home = lazy(()=>import('../pages/home/Home'))
let User = lazy(()=>import('../pages/user/User'))

export let homerouters = [
    {
        path:'/',
        element:<Home></Home>,
        title:'首页',
        icon:<AppOutline></AppOutline>
    },
    {
        path:'/mainLayout/message',
        element:<Message></Message>,
        title:'消息',
        icon:<MessageOutline></MessageOutline>
    },
    {
        path:'/mainLayout/props',
        element:<Props></Props>,
        title:'分类',
        icon:<MessageFill></MessageFill>
    },
    {
        path:'/mainLayout/user',
        element:<User></User>,
        title:'个人中心',
        icon:<UserOutline></UserOutline>
    },
]
let routers = createBrowserRouter(
    [
        {
            path:'/',
            element:<MainLayout></MainLayout>,
            children:homerouters,
        },
        {
            path:'/city',
            element:<City></City>,
        },
        {
            path:'/detail',
            element:<Detail></Detail>,
        },
        {
            path:'/order',
            element:<Order></Order>,
        },
        {
            path:'/login',
            element:<Login></Login>,
        },
        {
            path:'/register',
            element:<Regaiter></Regaiter>,
        },
        {
            path:'/xuan',
            element:<Xuan></Xuan>,
        },
        {
            path:'*',
            element:<Error></Error>
        }
    ]
)
export default routers